#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include "vm.h"

const size_t memory_sz = 64;

hardwareObject8* device8;

void genrand() {
  int i = device8->memory_start;
  int32_t* p;
  while (i < device8->memory_end) {
    p = (int32_t*)memget8(i);
    *p = rand();
    i+=4;
  }
}

bool detach() {
  regivt(0xC, NULL);
  return TRUE;
}

bool attach() {
  srand(time(NULL));
  regivt(0xC, genrand);
  return TRUE;
}

